<template>
  <div class="home" ref="homeRef" @touchstart="handleTouchStart" @touchend="handleTouchEnd">
    <div class="tcy">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/tcy.png" alt="">
    </div>
    <div class="tlp">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/tly.png" alt="">
    </div>
    <div class="try">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/try.png" alt="">
    </div>
    <div class="neirong">
      <div class="ft">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/ft1.png" alt="">
      </div>
      <div class="text">
        <div class="text1">时光的脚本轻轻，热爱的力量深深</div>
        <div class="text2">翻开这一页</div>
        <div class="text3">是属于你我的2024</div>
        <div class="text4">每一刻都在闪耀</div>
      </div>
      <div class="xx">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xx.png" alt="">
      </div>
      <div class="yf">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/yf.png" alt="">
      </div>
      <div class="hlh">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/hlh.png" alt="">
      </div>
      <div class="llh">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/llh.png" alt="">
      </div>
      <div class="dlh">
        <img class="dlhd" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/dlhd.png" alt="">
        <img class="bg" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bg.png" alt="">
        <img class="dlhs" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/dlh.png" alt="">
        <img class="lcd" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/lcd.png" alt="">
      </div>
      <div class="hzl">
        <img class="yb1" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/yb1.png" alt="">
        <img class="yb2" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/yb2.png" alt="">
        <img class="yb3" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/yb3.png" alt="">
        <img class="hg" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/hg.png" alt="">
        <img class="hz" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/hz.png" alt="">
      </div>
      <div class="cd">
        <img class="xhcd" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xhcd.png" alt="">
        <img class="dhcd" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/dhcd.png" alt="">
      </div>
    </div>
    <div class="haibao">
      <img class="homeImg" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/home.png" alt="">
      <img class="xfy" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xfy.png" alt="">
    </div>
    <div class="xft">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/ft1.png" alt="">
    </div>
    <div class="logo">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/logo.png" alt="">
    </div>
    <div class="btn" >
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/zsks.png" @click="toBoxFun">
      <img v-if="state.cjjlShow" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/cxcjjl.png" @click="chanxunzhongjiang">
    </div>
    <div class="bly">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bly.png" alt="">
    </div>
    <div class="bry">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bry.png" alt="">
    </div>
    <div class="userVerify" v-if="state.userVerifyShow">
      <div class="popupBox">
        <div class="selectBox" @click="state.sfxz = '0'">
          <img class="selectBoxAc" v-if="state.sfxz === '0'" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/dgyAc.png" alt="">
          <img v-else src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/dgy.png" alt="">
        </div>
        <div class="selectBox" @click="state.sfxz = '1'">
          <img class="selectBoxAc" v-if="state.sfxz === '1'" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/fdgyAc.png" alt="">
          <img v-else src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/fdgy.png" alt="">
        </div>
        <div class="selectBox" @click="state.sfxz = '2'">
          <img class="selectBoxAc" v-if="state.sfxz === '2'" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/qtAc.png" alt="">
          <img v-else src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/qt.png" alt="">
        </div>
        <img class="schb" style="margin-bottom: 25px" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/queren.png" alt="" @click="tanchangqiehuan">
      </div>
    </div>

    <div class="weichouzhong" v-if="state.weichouzhong">
      <div class="neirong">
        <div class="topBox">
          <img class="weitonghuan" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/xycj.png" alt="">
        </div>
        <img class="gb" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/gb.png" alt="" @click="state.weichouzhong = false">
        <div class="jsz">
          <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/yihan.png" alt="">
        </div>
        <div class="btnList">
          <img class="fhsy" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/fhsyl.png" alt="" @click="router.push({path:'/playIndex'})">
        </div>
        <img class="xfy" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/xfy.png" alt="">
        <img class="yf" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/yf1.png" alt="">
        <img class="xj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xiangji.png" alt="">
      </div>
    </div>
    <div class="chouzhongle" v-if="state.chouzhongle">
      <div class="neirong">
        <div class="topBox">
          <img class="weitonghuan" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/xycj.png" alt="">
        </div>
        <img class="gb" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/gb.png" alt="" @click="state.chouzhongle = false">
        <div class="jsz">
          <img v-if="state.qian === '100'" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/100.png" alt="">
          <img v-if="state.qian === '50'" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/50.png" alt="">
          <img v-if="state.qian === '30'" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/30.png" alt="">
          <img v-if="state.qian === '20'" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/20.png" alt="">
        </div>
        <div class="quaqnma">{{ state.cardPassword }}</div>
        <div class="btnList">
          <img class="fhsy" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/djfzqm.png" alt="" @click="copyText(state.cardPassword)">
        </div>
        <img class="yf" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/yf1.png" alt="">
        <img class="xj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xiangji.png" alt="">
        <img class="djlj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/djlj.png" alt="">
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import {onMounted, reactive, ref} from 'vue';
import {Session,Local} from '../../utils/storage'
import { homeCartoon } from './cartoon'
import { useRouter } from 'vue-router'
import useClipboard from "vue-clipboard3";
import {ElMessage} from "element-plus";
const router = useRouter()
const { toClipboard } = useClipboard();
const homeRef = ref();
const { handleTouchStart,handleTouchEnd } = homeCartoon(homeRef)
const state = reactive({
  hds:false,
  userVerifyShow:false,
  dataVerify:false,
  swks:true,
  sfxz:'0',
  cjjl:{},
  cjjlShow:false,
  weichouzhong:false,
  chouzhongle:false,
  qian:'',
  cardPassword:''
})
const chanxunzhongjiang = () => {
  if(Local.get('cjjl')){
    state.qian = Local.get('cjjl').price
    state.chouzhongle = true
    state.cardPassword = Local.get('cjjl').card_password
  } else {
    state.weichouzhong = true
  }

}
const copyText = (text: string) => {
  return new Promise((resolve, reject) => {
    try {
      //复制
      toClipboard(text);
      //下面可以设置复制成功的提示框等操作
      ElMessage.success('复制成功');
      resolve(text);
    } catch (e) {
      //复制失败
      ElMessage.error('复制失败');
      reject(e);
    }
  });
};
const toBoxFun = () => {
  // state.userVerifyShow = true
  if(!Session.get('token')){
    state.userVerifyShow = true
  } else {
    router.push({
      path:'/standing'
    })
  }
}
const tanchangqiehuan = () => {
  Session.set('token',state.sfxz)
  state.userVerifyShow = false
  router.push({
    path:'/standing'
  })
}
onMounted(() => {
  setTimeout(() => {
    state.hds = true;
  }, 8500);
  if(Local.get('cjjl')){
    state.cjjl = Local.get('cjjl')
    state.cjjlShow = true
  }
});
</script>

<style lang="scss" scoped>
.weichouzhong{
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: rgba(26, 26, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  .neirong{
    background-color: #fef0ff;
    border-radius: 24px;
    box-sizing: border-box;
    width: 85%;
    position: relative;
    z-index: 99999999999;
    .topBox{
      background-color: #bf78f7;
      width: 100%;
      height: 40px;
      border-top-left-radius: 24px;
      border-top-right-radius: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      .weitonghuan{
        width: 100px;
        height: 25px;
      }
    }
    .jpsy{
      width: 55%;
      height: 40px;
      border-radius: 40px;
      margin: 16px auto;
      border: 1px solid black;
      display: flex;
      align-items: center;
      justify-content: space-evenly;
      .jpsyText{
        height: 18px;
      }
      .szkang{
        width: 90px;
        height: 30px;
        background: url('https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/shuzibeijing.png');
        background-size: 100% 100%;
        background-position: center;
        background-repeat: no-repeat;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 19px;
      }
    }
    .btnList{
      display: flex;
      margin-top: 20px;
      margin-bottom: 60px;
      justify-content: space-evenly;
      img{
        width: 40%;
      }
    }
    .xfy{
      position: absolute;
      bottom: -1px;
      left: 0;
      width: 100%;
    }
    .gb{
      position: absolute;
      width: 40px;
      right: -15px;
      top: -15px;
    }
    .yf{
      position: absolute;
      width: 70px;
      left: -10px;
      bottom: 0px;
    }
    .xj{
      width: 70px;
      position: absolute;
      right: -25px;
      top: 50px;
    }
    .jsz{
      margin-top: 20px;
      img{
        width: 60%;
      }
    }
  }
}
.chouzhongle{
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: rgba(26, 26, 26, 0.45);

  display: flex;
  align-items: center;
  justify-content: center;
  .neirong{
    //background-color: #fef0ff;
    background: url('https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/cjbjc.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 24px;
    box-sizing: border-box;
    width: 85%;
    height: 520px;
    position: relative;
    z-index: 999999999;
    .topBox{
      background-color: #bf78f7;
      width: 100%;
      height: 40px;
      border-top-left-radius: 24px;
      border-top-right-radius: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      .weitonghuan{
        width: 100px;
        height: 25px;
      }
    }
    .jpsy{
      width: 55%;
      height: 40px;
      border-radius: 40px;
      margin: 16px auto;
      border: 1px solid black;
      display: flex;
      align-items: center;
      justify-content: space-evenly;
      .jpsyText{
        height: 18px;
      }
      .szkang{
        width: 90px;
        height: 30px;
        background: url('https://vivo.zhongwangyingtong.com/vivoimage/assets/image3/shuzibeijing.png');
        background-size: 100% 100%;
        background-position: center;
        background-repeat: no-repeat;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 19px;
      }
    }
    .btnList{
      display: flex;
      margin-top: 20px;
      margin-bottom: 60px;
      justify-content: space-evenly;
      img{
        width: 60%;
      }
    }
    .xfy{
      position: absolute;
      bottom: -1px;
      left: 0;
      width: 100%;
    }
    .gb{
      position: absolute;
      width: 40px;
      right: -15px;
      top: -15px;
    }
    .yf{
      position: absolute;
      width: 70px;
      left: -10px;
      bottom: 130px;
    }
    .xj{
      width: 70px;
      position: absolute;
      right: -25px;
      top: 50px;
    }
    .jsz{
      margin-top: 20px;
      img{
        width: 60%;
      }
    }
    .quaqnma{
      width: 60%;
      height: 40px;
      margin: 16px auto;
      background-color: white;
      border-radius: 40px;
      border: 1px solid black;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }
    .djlj{
      position: absolute;
      width: 70%;
      left: 20px;
      bottom: 20px;
    }
  }
}

.userVerify{
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  .popupBox{
    box-sizing: border-box;
    padding: 30px 20px;
    width: 80%;
    height: 300px;
    position: relative;
    background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/xaunzeshenfen.png");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;

    .dyBox{
      position: absolute;
      bottom: 0;
      width: 100%;
    }
    .xiangji{
      position: absolute;
      right: -30px;
      top: 50px;
      width: 80px;
    }
    .yfBox{
      position: absolute;
      left: -20px;
      bottom: -40px;
      width: 60px;
    }
    .schb{
      width: 80%;
      margin: 0 auto;
    }
    .selectBox{
      width: 80%;
      height: 50px;
      margin: 0 auto;
      position: relative;
      //overflow: hidden;
      .selectBoxAc{
        position: absolute;
        top: -5px;
        left: 0;
      }
    }
    .selectBox:nth-child(1){
      margin-top:20px;
    }
    .nameBox,.sjBox{
      //position: absolute;
      margin-top: 8px;
      width: 80%;
      height: 40px;
      z-index: 99;
      background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xmsr.png");
      background-size: 100% 100%;
      background-position: center;
      background-repeat: no-repeat;
      display: flex;
      align-items: center;
      :deep(.el-input__wrapper){
        border-radius: 50px !important;
        border: 1px solid black;
      }
      :deep(.el-input__inner){
        font-size: 18px;
        //text-align: center;
      }
      :deep(.el-input){
        width: 100%;
        height: 40px;
        border-radius: 40px !important;

      }
    }
  }
}
img {
  width: 100%;
}
.text{
  width: 100%;
  position: absolute;
  top: 40%;
  font-size: 18px;
  color: white;
  .text1,.text2,.text3,.text4{
    opacity: 0;
    //font-family: vivoSxgn;
  }
}
.haibao{
  position: absolute;
  display: none;
  width: 100%;
  bottom: 0;
  .homeImg{
    position: absolute;
    width: 100%;
    left: 0;
    bottom:-392px;
    display: none;
  }
  .xfy{
    width: 80%;
    position: absolute;
    left: 0;
    bottom: -150px;
  }
}
.xft{
  width: 70%;
  position: absolute;
  z-index: 9999;
  left: 35%;
  top: -130px;
}
.logo{
  position: absolute;
  width: 100%;
  display: flex;
  top: 190px;
  justify-content: center;
  opacity:0;
  img{
    width: 70%;
  }
}
.btn{
  position: absolute;
  width: 100%;
  display: flex;
  bottom: 70px;
  justify-content: center;
  opacity:0;
  z-index: 99;
  flex-direction: column;
  align-items: center;
  img{
    width: 70%;
  }
}
.home {
  width: 100%;
  height: 100%;
  background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bc.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
  .tlp {
    position: absolute;
    width: 80%;
    top: 0;
    left: 0;
  }

  .tcy {
    position: absolute;
    width: 65%;
    top: 15px;
    left: 28%;
  }

  .try {
    position: absolute;
    width: 50%;
    top: 0;
    right: 0;
    z-index: 1;
  }

  .ft {
    position: absolute;
    width: 80%;
    left: -40px;
  }

  .xx {
    width: 50%;
    position: absolute;
    top: 13%;
    left: 20%;
  }

  .yf {
    width: 17%;
    position: absolute;
    top: -100px;
    left: 11%;
  }

  .hlh{
    width: 12%;
    position: absolute;
    top: -100px;
    right: 20%;
  }

  .llh{
    width: 17%;
    position: absolute;
    top: -100px;
    right: 0;
  }

  .dlh{
    position: absolute;
    width: 150px;
    height: 150px;
    top: -150px;
    left: 4%;
    z-index: 5;
    .bg{
      width: 120%;
      display: none;
      position: absolute;
      top: -155px;
      left: 36px;
    }
    .dlhd{
      position: absolute;
      left: 15px;
      top: -10px;
      transform: rotate(15deg);
      z-index: 6;
    }
    .lcd{
      //z-index: 9;
      display: none;
      position: absolute;
      left: 100px;
      top: -80px;
    }
  }

  .hzl{
    //width: 200px;
    display: none;
    .yb1{
      position: absolute;
      width: 10px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .yb2{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .yb3{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .hg{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .hz{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
  }

  .cd{
    //position: absolute;
    display: none;
    .xhcd{
      width: 30px;
      position: absolute;
      bottom: 107px;
      right: 30px;
      z-index: 90;
    }
    .dhcd{
      width: 160px;
      position: absolute;
      bottom: 36px;
      right: 24px;
      z-index: 90;
    }
  }

  .bly {
    position: absolute;
    width: 95%;
    bottom: -10px;
    z-index: 1;
  }

  .bry {
    position: absolute;
    width: 100%;
    right: 0;
    bottom: -10px;
    z-index: 50;
  }
}
</style>
